# 组件库
from peewee import AutoField, CharField
from playhouse.mysql_ext import JSONField
from common.model.abstrct import AbstractModel, IntEnumField
from enums.component_enum import ComponentStatusEnum


# 组件
class Component(AbstractModel):

    class Meta:
        table_name = "tb_component"
        indexes = (
            (("component_code", ), True),
        )
    component_id = AutoField(primary_key=True, help_text="组件id")
    component_code = CharField(max_length=16, help_text="组件code, 唯一")
    component_name = CharField(max_length=32, help_text="组件名称")
    component_icon = CharField(max_length=255, help_text="组件icon")
    status = IntEnumField(help_text="组件状态", choices=ComponentStatusEnum)

    default_style = JSONField(null=True, help_text="组件默认样式")


# class ComponentTemplate(AbstractModel):
#
#     class Meta:
#         table_name = "tb_component_template"
#
#     template_id = AutoField(primary_key=True, help_text="模版id")
#     template_name = CharField(max_length=32, help_text="模版名称")
#

